Qt.include("QtPrototype.js")

/*****************OO******************************************/

// properties are directly passed to `create` method
var Person = Class.create({
  initialize: function(name) {
    this.name = name;
  },
  say: function(message) {
    return this.name + ': ' + message;
  }
});
// when subclassing, specify the class you want to inherit from
var Pirate = Class.create(Person, {
  // redefine the speak method
  say: function($super, message) {
    return $super(message) + ', yarr!';
  }
});
var john = new Pirate('Long John');
var Captain = Class.create(Pirate, {});

print(john.say('ahoy matey'));
// -> "Long John: ahoy matey, yarr!"

print(Person.superclass);
// -> null
print(Person.subclasses.length);
// -> 1
print(Person.subclasses.first() == Pirate);
// -> true
print(Pirate.superclass == Person);
// -> true
print(Captain.superclass == Pirate);
// -> true
print(Captain.superclass == Person);
// -> false

/*****************others******************************************/

var a = ["QML", "JavaScript", "are", "close", "friends."];

a.each(function(iter,index){
        print(index+" "+ iter);
        }
       );
